package solution;

import task.Board;
import task.Official;
 
public class Field {
	
	Board board;
	Official official;
	Coordination coordination;
	boolean[] hasWalls; //length 4: 0 north, 1 east, 2 south, 3 west 
	private boolean isBlocked;
	
	public Field(int x, int y, Board board){
		coordination = new Coordination(x, y);
		hasWalls = new boolean[4]; 
		this.board = board;
		isBlocked = false;
	}
	
	public Board getBoard() {
		return board;
	}

	public void setBoard(Board board) {
		this.board = board;
	}

	public Coordination getCoordination() {
		return coordination;
	}

	public void setCoordination(Coordination coordination) {
		this.coordination = coordination;
	}

	public void setOfficial(Official official){
			this.official = official;
	}
	
	public Coordination getCoordinations() {
		return coordination;
	}


	public void setCoordinations(Coordination coordination){
		this.coordination = coordination;
	}

	public Official getOfficial(){
		return official;
	}
	
	public boolean isBlocked(){
		return isBlocked;
	}
	
	public void setBlocked(boolean isBlocked){
		this.isBlocked = isBlocked;
	}
	
	public boolean isOccupied(){
		return official != null;
	}
	
	public void setWall(int orientation, boolean hasWall){
		if (orientation >=0 && orientation <4){
			hasWalls[orientation] = hasWall;
		}
	}
	
	public boolean hasWall(int orientation){
		if (orientation >=0 && orientation <4){
			return hasWalls[orientation];
		}
		else
		{
			return false;
		}
	}
	
}
